namespace Umdf.ComInterop
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;

    [ComImport, TypeLibType((short) 0x200), InterfaceType((short) 1), Guid("AB098F88-8F16-472A-B0BC-ECA46486C102")]
    public interface IWDFMemory : IWDFObject
    {
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void DeleteWdfObject();
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void AssignContext([In, MarshalAs(UnmanagedType.Interface)] IObjectCleanup pCleanupCallback, [In] IntPtr pContext);
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void RetrieveContext(out IntPtr ppvContext);
        [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void AcquireLock();
        [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void ReleaseLock();
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void CopyFromMemory([In, MarshalAs(UnmanagedType.Interface)] IWDFMemory Source, [In] ref _WDFMEMORY_OFFSET SourceOffset);
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void CopyToBuffer([In, ComAliasName("Umdf.ComInterop.ULONG_PTR")] uint SourceOffset, [In] IntPtr TargetBuffer, [In, ComAliasName("Umdf.ComInterop.ULONG_PTR")] uint NumOfBytesToCopyTo);
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void CopyFromBuffer([In, ComAliasName("Umdf.ComInterop.ULONG_PTR")] uint DestOffset, [In] IntPtr SourceBuffer, [In, ComAliasName("Umdf.ComInterop.ULONG_PTR")] uint NumOfBytesToCopyFrom);
        [return: ComAliasName("Umdf.ComInterop.ULONG_PTR")]
        [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        uint GetSize();
        [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        IntPtr GetDataBuffer([ComAliasName("Umdf.ComInterop.ULONG_PTR")] out uint BufferSize);
        [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void SetBuffer([In] IntPtr Buffer, [In, ComAliasName("Umdf.ComInterop.ULONG_PTR")] uint BufferSize);
    }
}

